/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-04-14
 * Time: 17:52
 */
public class test {
    public int maxProfit(int[] prices) {
        int n = prices.length;
        int ret = 0;
        for(int i = 1;i<n;i++){
            ret += Math.max(0,prices[i]-prices[i-1]);
        }
        return ret;
    }
}
